<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //提取邮箱地址
    var str='3172587707@qq.com 15514224206@163.com....';
    //()小括号代表优先级 每一个小括号还代表一个匹配规则
    var array=str.match(/\w+@[a-zA-Z0-9]+.[a-zA-Z0-9]+/g);
    console.log(array);

    //re
    var reg=/\w+@[a-zA-Z0-9]+\.[a-zA-Z0-9]+/g;
    var array1=reg.exec(str);
    console.log(array1);
    //$小括号规则 $1第一个规则
    console.log(RegExp.$1);
    console.log(RegExp.$2);
    console.log(RegExp.$3);

    var str1='abab .aba ba ba.b';
    var str2=str1.replace(/\w/g,'z');
    console.log(str2);
</script>
</html>